/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Modelo;


import java.sql.*;


   public class ConexionBaseDatos {
          private String usuario="root";
          private String password="";
          private String url="jdbc:mysql://localhost/bd_ninema1";
          public Connection con;
    
   public ConexionBaseDatos(){
   
   }
   
   public Connection Conexion(){
        try{
            Class.forName("org.gjt.mm.mysql.Driver");

        }catch(java.lang.ClassNotFoundException e){
            System.err.print("ClassNotFoundException: ");
	    System.err.println(e.getMessage());
       
        } try {

        con=DriverManager.getConnection(url,usuario,password);

            } catch (SQLException ex) {

        System.err.println("SqlException:"+ ex.getMessage());
           }

            return con;

    }
 
   public void CerraBaseDatos(){
        
       try
       {DriverManager.getConnection(url,usuario,password).close();
       }catch(SQLException e){
           System.out.print(""+e.getMessage());
       }
    }
}

   

